<template>
	<view class="mine">
		<view class="cont">
			<view class="userinfo">
				<view class="left">
					<image class="avatar" :src="userinfo.head" mode="aspectFill"></image>
					<view class="name">
						<view class="nickName">{{userinfo.nickname}}</view>
						<view class="phone">{{userinfo.mobile}}</view>
					</view>
				</view>
				<!-- <view class="right" @click="editUserInfo">
					编辑资料 <u-icon name="arrow-right" color="#B59F9D"></u-icon>
				</view> -->
			</view>
			<view class="margin"></view>
			<view class="toolList">
				<view class="toolItem" v-for="item in state.toolList" :key="item.name" @click="handle(item)">
					<view class="left">
						<u-icon :name="item.icon" size="20"></u-icon>
						<view class="mr20"></view>
						{{item.name}}
					</view>
					<view class="icon">
						<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
					</view>
				</view>
				<view class="toolItem" @click="handle({url:'/pages/mine/checkUser'})" v-if="userinfo.isChecker === 1">
					<view class="left">
						<u-icon name="fingerprint" size="20"></u-icon>
						<view class="mr20"></view>
						待审核用户
					</view>
					<view class="icon">
						<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
import { reactive } from 'vue';
import { useUserinfo } from '@/store/userinfo.js'
import { storeToRefs } from 'pinia'
const Userinfo = useUserinfo()
const { userinfo } = storeToRefs(Userinfo)
const editUserInfo = () => {
	uni.navigateTo({
		url: '/pages/mine/editUserInfo'
	})
}
	const state = reactive({
		toolList:[
			{icon:'setting-fill',name:'个人信息',url:'/pages/mine/editUserInfo'},
			{icon:'heart-fill',name:'我的收藏',url:'/pages/mine/myCollect'},
		]
	})
	const handle = (item) => {
		uni.navigateTo({
			url: item.url
		})
	}
</script>

<style lang="scss" scoped>
.mine {
	position: relative;
	.cont {
		position: relative;
		z-index: 2;
		padding: 30rpx;
		.userinfo {
			padding-top: 15rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			overflow: hidden;
			min-width: 0;
			.left {
				flex: 1;
				display: flex;
				justify-content: flex-start;
				align-items: center;
				min-width: 0;
				.avatar {
					$s: 140rpx;
					width: $s;
					height: $s;
					border-radius: 50%;
					border: 4rpx solid #FFFFFF;
					flex-shrink: 0;
					margin-right: 20rpx;
				}
				.name {
					overflow: hidden;
					.nickName {
						font-size: 40rpx;
						font-size: 600;
						color: #333;
						margin-bottom: 8rpx;
						// white-space: nowrap;
						// text-overflow: ellipsis;
						// overflow: hidden;
					}
					.phone {
						font-size: 28rpx;
						color: #B59F9D;
					}
				}
			}
			.right {
				display: flex;
				justify-content: flex-end;
				align-items: center;
				font-size: 28rpx;
				color: #B59F9D;
			}
		}
		.loginService {
			margin-top: 24rpx;
			border-radius: 16rpx;
			text-align: center;
			$h: 76rpx;
			height: $h;
			line-height: $h;
			font-size: 32rpx;
			background-color: #FFDDCA;
			color: $main-color;
		}
		.margin {
			margin-bottom: 70rpx;
		}
		.title {
			font-size: 36rpx;
			font-weight: 600;
			color: #333333;
			margin-bottom: 24rpx;
		}
		.grid {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 70rpx;
			.gridItem {
				width: 140rpx;
				text-align: center;
				.icon {
					$s: 58rpx;
					width: $s;
					height: $s;
					margin-bottom: 12rpx;
				}
				.itemName {
					font-size: 30rpx;
					color: #8D93A5;
				}
			}
		}
		
		.toolList {
			padding: 20rpx 30rpx;
			.toolItem {
				display: flex;
				justify-content: flex-start;
				align-items: center;
				margin-bottom: 35rpx;
				border-bottom: 1px solid rgba(0, 0, 0, 0.1);
				padding-bottom: 30rpx;
				.left {
					flex: 1;
					display: flex;
					justify-content: flex-start;
					align-items: center;
					font-size: 30rpx;
					color: #333;
					.icon {
						$s: 58rpx;
						width: $s;
						height: $s;
						margin-right: 6rpx;
					}
				}
				.icon {
					flex-shrink: 0;
				}
			}
		}
	}
	.gzh {
		padding: 20rpx;
		background-color: #FFFFFF;
		border-radius: 16rpx;
		.title {
			text-align: center;
			font-size: 32rpx;
			color: #333;
			font-weight: 600;
			margin-bottom: 30rpx;
		}
		.gzhPic {
			$s: 500rpx;
			width: $s;
			height: $s;
		}
		.tips {
			color: $uni-text-color-grey;
			font-size: 26rpx;
			text-align: center;
			padding: 20rpx 0;
		}
	}
}
</style>
